﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class MenuRolesControllerBase : Controller{
	public MenuRolesControllerBase()
		: base()
	{
	}
	private static MenuRolesDAO _Service; 
	public static MenuRolesDAO Service{
		get{
			if(_Service==null)
				_Service = new MenuRolesDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public MenuRolesEntity MapDataRowToObject(DataRow row){
		MenuRolesEntity o = new MenuRolesEntity();
		 if(!row.IsNull("MenuId"))
			o.MenuId=(Int32)(row["MenuId"]);
		 if(!row.IsNull("RoleId"))
			o.RoleId=(Int32)(row["RoleId"]);
		 if(!row.IsNull("MenuRoleId"))
		    o.MenuRoleId=(Int32)(row["MenuRoleId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(MenuRolesEntity o,DataRow row){
		row["MenuId"]=o.MenuId;
		row["RoleId"]=o.RoleId;
		row["MenuRoleId"]=o.MenuRoleId;
    }
}
}
